package com.kingyea.mobilepolice.apimanage.utils.ws.bean;

import javax.activation.DataHandler;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * CXF上传和下载文件对象包装类 由于DataHandler无法获取文件名和文件类型，需要在上传和下载时附带文件名
 */
@XmlRootElement(namespace = WebServiceConstant.NAMESPACE)
@XmlAccessorType(XmlAccessType.FIELD)
public class AttachmentWrapper {

    // 文件名
    private String fileName = null;

    // 文件扩展名
    private String fileExtension = null;

    // 文件二进制数据
    // 注这是一个附件类型的数据
    @XmlMimeType("application/octet-stream")
    private DataHandler file = null;

    public final String getFullName() {
        return this.fileName + "." + this.fileExtension;
    }

    public final String getFileName() {
        return this.fileName;
    }

    public final void setFileName(final String fileName) {
        this.fileName = fileName;
    }

    public final String getFileExtension() {
        return this.fileExtension;
    }

    public final void setFileExtension(final String fileExtension) {
        this.fileExtension = fileExtension;
    }


    public final DataHandler getFile() {
        return this.file;
    }

    public final void setFile(final DataHandler file) {
        this.file = file;
    }
}